/**
 * upload
 */
var multer = require('multer');
var config = require('./config');
var path = require('path');
// var config = require('./config');
var storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null,config.rootPath)
    },
    filename: function (req, file, cb) {
        cb(null,Date.now()+Math.round(Math.random()*10000)+ "."+file.mimetype.slice(file.mimetype.indexOf('/')+1))
    }
});
//添加配置文件到muler对象。
var upload = multer({
    storage: storage
});
module.exports = upload;